/*
	Flie:						CGameplayState.h
	Course:				SGP 1208
	Author:				Kori Po
	Purpose:			Gameplay Mode
*/

#pragma once
#include "IState.h"




// SGD Wrappers
#include "../SGD Wrappers/CSGD_Direct3D.h"
#include "../SGD Wrappers/CSGD_DirectInput.h"
#include "../SGD Wrappers/CSGD_TextureManager.h"
#include "../SGD Wrappers/CSGD_XAudio2.h"

#include "../SGD Wrappers/CSGD_ObjectFactory.h"

#include "../SGD Wrappers/SGD_String.h"

#define PAUSEMENUITEMS 2

#include "TempFont.h"
#include "Player.h"
#include "Enemy.h"
#include "ObjectManager.h"

#include "AnimationManager.h"



typedef	CSGD_ObjectFactory< TSTRING, CEntity >	CSGD_Factory;


#include "Kori's Factory.h"
#include "Event.h"
#include "Item.h"
#include "EventSystem.h"
#include "MessageSystem.h"

typedef CObjectFactory< TSTRING, CEntity >	 C_Factory;

class CGameplayState : public IState, public IListener
{
	// Def Con && Decon
	CGameplayState(void);
	virtual ~CGameplayState(void);

	// Wrapper Pointers
	CSGD_Direct3D*						m_3DGuy;
	CSGD_DirectInput*					m_InputGuy;
	CSGD_TextureManager*				m_TextureGuy;
	CObjectManager*						m_ObjManager;
	CSGD_XAudio2*						m_AudioGuy;
	CSGD_Factory*						m_FactoryGuy;


	CAnimation*				m_Animation;


	// Object Handlers
	C_Factory*									m_Factory;

	//Triggerables
	CEventSystem*							m_EventHQ;
	CMessageSystem*						m_Messenger;

	// Asset IDs
	int							m_nMenuWizardID;
	int							m_nBackGroundID;
	int							m_nOptionsBoxID;
	int							m_nGUIID;
	int							m_nMarkID;
	int							m_nAbilityIconID;

	int							m_nIconItem;
	int							m_nIconPlayer;

	int m_nTankImgID;

	// Menu DMs
	int			m_nSelectedItem;
	bool		m_MenuSelection[PAUSEMENUITEMS];
	char*		m_szMenuItem[PAUSEMENUITEMS];
	RECT		m_MenuRect[PAUSEMENUITEMS];

	// Misc Functions
	void		Mouseinthebox();
	
	// Font DMs
	CTempFont*		m_MenuFont;	

	bool						m_bPause;

	CEntity*				m_Player1;

	//CPlayer*				m_Player;
	//CEnemy*				m_Enemy;

	// Temp DMs
	bool						m_bEventTigger;
	bool						m_bMessageTigger;
	
	// Temp Helper Functions
	void						RegisterEvents( );
	void						HandleEvent( CEvent* pEvent );

	int						m_nCurrentLevel;
	int						m_nCurrentWorld;
	
	void					SaveGame(int nSlotNumber);
	bool					m_bHasLost;
	//void					SendMessages();




public:
	// SINGLETON
	static CGameplayState* GetInstance( void );

	// EnE Functions
	virtual void Enter(void);			//Load Resources
	virtual void Exit(void);				//Unload Resources
	
	// Running Functions
	virtual bool Input(void);			//Handle user input
	virtual void Update(float fElapsedTime);		//Update game tokens
	virtual void Render(void) ;		//Render game tokens

	// Message handle
	static void MessageProc( IMessage* pMsg );

	int				GetWorld		( void ) const	{	return m_nCurrentLevel;			}
	int				GetLevel		( void ) const	{	return m_nCurrentWorld;		}
	void			SetWorld		( int		nLevel		)		{	m_nCurrentLevel		=	nLevel;		}
	void			SetLevel		( int		nWorld		)		{	m_nCurrentWorld		=	nWorld;		}

	//Testing Purpose
	CPlayer*				m_Player;
	CEnemy*					m_Enemy;
	//CObjectManager*			m_ObjManager;
};

